* Create dataset from Luc Laeven and Fabian Valencia (2012)

use "LV/input/allcrisis.dta", clear // crisis dataset in strong panel form
egen countryid = group(country)
tsset countryid year, yearly
tsfill, full
sort countryid year
save "LV/temp/allcrisis_temp.dta", replace
keep country countryid
duplicates drop
drop if country==""
sort countryid
save "LV/temp/names_temp.dta", replace
use "LV/temp/allcrisis_temp.dta", clear
drop country
sort countryid
merge m:1 countryid using "LV/temp/names_temp.dta"
drop _merge
order country, first
replace banking=0 if banking==.
replace restructuring=0 if restructuring==.
replace currency=0 if currency==.
replace sovereign=0 if sovereign==.
drop if year>2010 // Johnson Noguera gets only up to 2009
replace country="China" if country=="China, P.R."
sort country year
save "LV/output/LV.dta", replace
